<?php
/**
 * Help page controller
 *
 * @author Dima
 *
 */

class HelpController extends modules_default_controllers_ControllerBase
{
	protected $_bForLoggedUsersOnly = false;
	protected $_contentLayout = 'frontpage';

//----------------------------------------------------------------------------------------------------

	public function init()
	{
		if (! $this->getRequest()->isXmlHttpRequest())
		{
			parent::init();
			$categoryTree = array();
			
			$this->view->title = 'Help';
			$this->view->TreeTitle = 'Help';
			
			$allHelpTitle 	= models_HelpMapper::getAll(null, 100);
			$i 				= 1;
			
			foreach ($allHelpTitle['array'] as $item)
			{
				$categoryTree[0][$i++] = array(
						'url' => '/help/view/id/' . $item->id,
						'anchor' => $item->title ,);
				
			}
			
			
			$this->view->TreeCategories = $categoryTree;
		}
		$this->_helper->AjaxContext()->initContext('json');
	}

//----------------------------------------------------------------------------------------------------

	public function indexAction()
	{
	}

//----------------------------------------------------------------------------------------------------
		
	public function editAction()
	{
		$this->view->title = 'Help';
		$oRequest 		= $this->getRequest();
	}
	
//----------------------------------------------------------------------------------------------------

	public function viewAction()
	{
		$this->view->title 	= 'Help';
		$oRequest 			= $this->getRequest();
		$id					= $oRequest->getParam('id');
		
		$oItem				= models_HelpMapper::findById($id);
		
		$this->view->oItem	= $oItem;
	}
	
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
	
}
